package com.sergio.compress.model.base;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.Objects;

/**
 * @Author : Sergio.D
 * @Description :
 * @CreateDate ：2023/6/17 11:56
 */
public class MockDataChildBase {
    @Accessors(chain = true)
    @Getter
    @Setter
    private int userId;
    @Accessors(chain = true)
    @Getter
    @Setter
    private long userName;
    @Accessors(chain = true)
    @Getter
    @Setter
    private int userId1;
    @Accessors(chain = true)
    @Getter
    @Setter
    private long userName1;
    @Accessors(chain = true)
    @Getter
    @Setter
    private int userId2;
    @Accessors(chain = true)
    @Getter
    @Setter
    private long userName2;
    @Accessors(chain = true)
    @Getter
    @Setter
    private short aa;
    @Accessors(chain = true)
    @Getter
    @Setter
    private byte bb;
    @Accessors(chain = true)
    @Getter
    @Setter
    private short aa1;
    @Accessors(chain = true)
    @Getter
    @Setter
    private byte bb2;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        MockDataChildBase that = (MockDataChildBase) o;

        StringBuilder mismatchedItems = new StringBuilder();

        if (userId != that.userId) {
            mismatchedItems.append("userId: ").append(userId).append(" != ").append(that.userId).append("\n");
        }
        if (userName != that.userName) {
            mismatchedItems.append("userName: ").append(userName).append(" != ").append(that.userName).append("\n");
        }
        if (userId1 != that.userId1) {
            mismatchedItems.append("userId1: ").append(userId1).append(" != ").append(that.userId1).append("\n");
        }
        if (userName1 != that.userName1) {
            mismatchedItems.append("userName1: ").append(userName1).append(" != ").append(that.userName1).append("\n");
        }
        if (userId2 != that.userId2) {
            mismatchedItems.append("userId2: ").append(userId2).append(" != ").append(that.userId2).append("\n");
        }
        if (userName2 != that.userName2) {
            mismatchedItems.append("userName2: ").append(userName2).append(" != ").append(that.userName2).append("\n");
        }
        if (aa != that.aa) {
            mismatchedItems.append("aa: ").append(aa).append(" != ").append(that.aa).append("\n");
        }
        if (bb != that.bb) {
            mismatchedItems.append("bb: ").append(bb).append(" != ").append(that.bb).append("\n");
        }
        if (aa1 != that.aa1) {
            mismatchedItems.append("aa1: ").append(aa1).append(" != ").append(that.aa1).append("\n");
        }
        if (bb2 != that.bb2) {
            mismatchedItems.append("bb2: ").append(bb2).append(" != ").append(that.bb2).append("\n");
        }

        if (mismatchedItems.length() > 0) {
            System.out.println("Not all properties are equal:");
            System.out.println(mismatchedItems.toString());
            return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        return Objects.hash(userId, userName, userId1, userName1, userId2, userName2, aa, bb, aa1, bb2);
    }
}
